package jmir.oscar.panell.figures;

public class Hexagon extends Figura2D{

	private final double costat;
	
	//Constructor en el que li pases un dels 6 costats
	public Hexagon(int coordenadaX, int coordenadaY, double costat, Color colorFondo, Color colorBorde, int anchoBorde) {
		super(coordenadaX, coordenadaY, colorFondo, colorBorde, anchoBorde);
		this.costat = costat;
	}

	public Hexagon(Color colorFondo, Color colorBorde, int anchoBorde, int costat) {
		super(colorFondo, colorBorde, anchoBorde);
		this.costat = costat;
	}
	
	public Hexagon(int costat) {
		super();
		this.costat = costat;
	}


	public double getCostat() {
		return costat;
	}

	@Override
	public double calculaPerimetre() {
		double perimetre;
		perimetre = getCostat()*6;
		return perimetre;
	}

	@Override
	public double calculaSuperficie() {
		double areaQuadrat;
		areaQuadrat = getCostat()*getCostat()/2;
		areaQuadrat = areaQuadrat*6;
		return areaQuadrat;
	}

	@Override
	public String toString() {
		return "Hexagon [costat=" + costat + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		long temp;
		temp = Double.doubleToLongBits(costat);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof Hexagon))
			return false;
		Hexagon other = (Hexagon) obj;
		if (Double.doubleToLongBits(costat) != Double
				.doubleToLongBits(other.costat))
			return false;
		return true;
	}

	
		
	
}
